package com.io.output;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class StoringAndRecoveringData {

	static String file = "F:/BufferedInputFile.java";

	public static void main(String[] args) throws IOException {
		DataOutputStream out = new DataOutputStream(new BufferedOutputStream(
				new FileOutputStream(file)));
		out.writeDouble(3.1415926);
		out.writeUTF("我是哈啊哈");
		out.writeDouble(1.414);
		out.close();

		DataInputStream in = new DataInputStream(new BufferedInputStream(
				new FileInputStream(file)));
		System.out.println(in.readDouble());
		System.out.println(in.readUTF());
		System.out.println(in.readDouble());
	}

}
